package com.microservice.consumer.service.impl;

import com.microservice.consumer.mapper.ConsumerMapper;
import com.microservice.consumer.service.IConsumerService;
import com.microservice.core.domain.AjaxResult;
import com.microservice.model.consumer.ConsumerInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class ConsumerServiceImpl implements IConsumerService {

    @Resource
    private ConsumerMapper consumerMapper;

    @Override
    public AjaxResult getConsumeMessage() {
        return AjaxResult.success("消费者接收成功", "hello world");
    }

    @Override
    public AjaxResult consumeMessagePost()  {
        ConsumerInfo consumerInfo = new ConsumerInfo();
        consumerInfo.setName("consumer2");
        int count = consumerMapper.insert(consumerInfo);
        return AjaxResult.success("插入数据条数：" + count,count);
    }
}
